home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Communications
/
General
/
LineShare Folder
/
Put Onto Productions Disks
/
LineShare Scripts
/
Generic ARA&Data
< prev
next >
Wrap
Text File
|
1994-02-18
|
6KB
|
265 lines
!$ Version 2.1
!$ Requires: any modem
!$ Supports: ARA and a generic comm. software (QuickMail, BBS, etc) in the server mode.
!$ Use: ARA/LineShare for ARA.
!$ Read: your modem manual to modify the "AT" strings.
!$ See: the Generic Scripts Guide for details.
^2 Speaker On: = Enum("Never" = "0" , "When Connecting" = "1", "Always"="2") "1"
^3 Speaker Volume: = Enum("Low"="1","Medium"="2","High"="3") "2"
^4 Answer On: = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
^5 Adjust Port Speed: = Bool("Yes"="1","No"="0") "0"
^6 AT for Receive: = Text ""
^7 AT for ARA calls: = Text ""
^8 Max Port Speed: = Enum("2400","9600","19200","38400") "9600"
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@Hangup
SetTries 2
Flush
HsReset 0,0,17,19,0,0
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
matchclr
matchstr 1 2 "OK\r\n"
write "ATH0&F\r"
matchread 20
ChrDelay 1
Write "+++"
ChrDelay 0
DtrClear
pause 10
DtrSet
!
DecTries
IfTries 0 1
!
! OSErr -6019 "Modem error - the modem is not responding"
!
exit -6019
@Label 2
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
SetVar A ""
IfStr A 50 "^6^7"
@Label 10
SerReset Val("^8"),0,8,1
Jsr 80
!
! Set the common options
Jsr 70
!
! Set the communication options:
! • ^6 for receive mode (disable MNP), <DCE Speed>/ARQ message, hw flow control
Write "AT^6\r"
Jsr 100
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after ^4 rings
!
Write "ATS0=^4\r"
Jsr 100
Note "Waiting for ARA/Data calls…"
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 2 minutes, then reinitiate the modem
!
@Label 12
MatchClr
matchstr 1 13 "RING\r\n"
matchstr 2 21 "\r\nCONNECT ^$/"
matchstr 3 15 "\r\nCONNECT ^$\r\n"
matchstr 10 10 "\r\nNO "
matchstr 11 10 "\r\nBUSY"
Matchread 1200
Jump 10
@Label 13
Note "Ring…"
Jump 12
!
! Data connection has been established (we read "CONNECT XXX\r\n")
! Put the "CONNECT" back to the buffer and attach the "Data" subPort
! if it was an incoming call, put the "RING" before the "CONNECT"
!
@Label 15
SetVar A "^$"
Note "Non-V.42 Call at ^A bps. Waiting for an ARA frame."
MatchClr
MatchStr 1 20 "\r"
MatchStr 2 30 "\08\01\03\14\04\03\00\08\250\16\03"
MatchRead 40
@Label 20
Note "Non-ARA call"
Jump 24
!
! V.42 call detected
!
@Label 21
SetVar A "^$"
Note "V.42 Call at ^A bps"
MatchClr
MatchStr 1 24 "\r\n"
MatchRead 5
@Label 24
QueueInput "\r\nRING\r\n\r\nCONNECT ^A\r\n"
@Label 25
Attach "Data" (DTR,Escape,TimeLimit=0)
!
! The ARA (MNP 4) frame detected
!
@Label 30
Note "ARA call at ^A bps."
Flush
QueueInput " ^A\r\n"
@Label 31
ifStr 5 32 "1"
QueueInput "\r\nCARRIER "
Jump 35
@Label 32
QueueInput "\r\nCONNECT "
@Label 35
ifOriginate 36
QueueInput "\r\nRING\r\n"
@Label 36
Attach "ARA" (DTR,Escape,TimeLimit=0)
@Label 50
Note "Suspended"
Say "Press the Option button to enter the AT-strings for your modem!"
Pause 1200
Jump 50
! ------------------------------------------
! Originating a call through the "ARA" subport
! ------------------------------------------
@ORIGINATE "ARA"
SerReset Val("^8"),0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Data mode:
! • ^7 For ARA calls
! • S7: time-out (90 sec) for long-distance call (if you use them)
!
Write "AT^7S7=90\r"
Jsr 100
!
! Prepare to receive all error result codes
!
Jsr 90
MatchStr 1 31 "\r\nCONNECT"
MatchRead 900
Write "\r"
Exit -6019
! ------------------------------------------
! Originating a call through the "Data" subport
! ------------------------------------------
@ORIGINATE "Data"
SerReset Val("^8"),0,8,1
Jsr 80
Jsr 70
!
! Now emit all commands that the application has sent to that port
!
Jsr 60
SerReset *
Jsr 80
!
! Prepare to receive all error result codes
!
Flush
Jsr 90
MatchStr 1 48 "^$\r\nCONNECT"
MatchRead 900
Write "\r"
Exit -6019
@Label 48
QueueInput "^$\r\nCONNECT"
Jump 25
!
! This section emits all modem commands sent from the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
! dialtone detect + connect at the highest rate + speaker control +
! hang up on Dtr drop + DCD valid
! Verbal responses mode, no echo
! Disable extended codes
!
@Label 70
Write "ATX4M^2L^3&D2&C1V1E0\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
Write "ATD^1\r"
HsReset *
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 102 "\r\nOK\r\n"
MatchStr 2 101 "\r\nERROR\r\n"
MatchRead 20
@Label 101
Exit -6019
@Label 102
return